package com.sxf.core.validator;



import com.sxf.consts.Consts;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.*;

/**
 * @author zjzy
 */
@Documented
@Constraint(validatedBy = {DateValid.class })
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE, ElementType.CONSTRUCTOR, ElementType.PARAMETER, ElementType.TYPE_USE})
@Retention(RetentionPolicy.RUNTIME)
@Repeatable(DateMatcher.List.class)
public @interface DateMatcher {
    String message() default "日期格式无效,格式应为yyyy-MM-dd HH:mm:ss";
    boolean required() default false;
    String format() default Consts.COMMON_FULLDATE_PATTERN;
    Class<?>[] groups() default {};
    Class<? extends Payload>[] payload() default {};

    @Target({ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE, ElementType.CONSTRUCTOR, ElementType.PARAMETER, ElementType.TYPE_USE})
    @Retention(RetentionPolicy.RUNTIME)
    @Documented
    public @interface List {
        DateMatcher[] value();
    }
}
